package cn.iocoder.yudao.module.station.dal.mysql.cylinderblacklist;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.station.dal.dataobject.cylinderblacklist.CylinderBlacklistDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.station.controller.admin.cylinderblacklist.vo.*;

/**
 * 钢瓶黑名单 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CylinderBlacklistMapper extends BaseMapperX<CylinderBlacklistDO> {

    default PageResult<CylinderBlacklistDO> selectPage(CylinderBlacklistPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CylinderBlacklistDO>()
                .eqIfPresent(CylinderBlacklistDO::getCylinderCode, reqVO.getCylinderCode())
                .eqIfPresent(CylinderBlacklistDO::getChipCode, reqVO.getChipCode())
                .eqIfPresent(CylinderBlacklistDO::getRecordUser, reqVO.getRecordUser())
                .betweenIfPresent(CylinderBlacklistDO::getRecordTime, reqVO.getRecordTime())
                .eqIfPresent(CylinderBlacklistDO::getRecordStation, reqVO.getRecordStation())
                .betweenIfPresent(CylinderBlacklistDO::getMakeTime, reqVO.getMakeTime())
                .betweenIfPresent(CylinderBlacklistDO::getLastCheckTime, reqVO.getLastCheckTime())
                .betweenIfPresent(CylinderBlacklistDO::getNextCheckTime, reqVO.getNextCheckTime())
                .eqIfPresent(CylinderBlacklistDO::getGasCylinderSpeci, reqVO.getGasCylinderSpeci())
                .eqIfPresent(CylinderBlacklistDO::getCylinderStatus, reqVO.getCylinderStatus())
                .eqIfPresent(CylinderBlacklistDO::getInterceptReason, reqVO.getInterceptReason())
                .betweenIfPresent(CylinderBlacklistDO::getInterceptTime, reqVO.getInterceptTime())
                .betweenIfPresent(CylinderBlacklistDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CylinderBlacklistDO::getId));
    }

    default Long getCountByCylinderCode(String cylinderCode) {
        return selectCount(CylinderBlacklistDO::getCylinderCode, cylinderCode);
    }

}